<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //定义一个含有30个整型元素的数组，按顺序分别赋予从2开始的偶数；然后按顺序每五个数求出一个平均值，放在另一个数组中并输出。试编程。
        var arr = [];
        var arr2 = [];
        var add = 0;
        var res;
        for (var a = 1; a <= 30; a++) {
            arr.push(a*2)
            add += (a  * 2)
            if (a % 5 == 0) {
                res = add/5;
                arr2.push(res);
                add =0;
            }
        }
        console.log(arr)
        console.log(arr2);
    </script>
</body>

</html>